package com.fdb.efp.esb.service.mock.hj;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.fdb.efp.esb.service.bo.req.hj.ReqLoanOpeAndIssBean;
import com.fdb.efp.esb.service.bo.resp.hj.RespLoanOpeAndIssBean;
import com.fdb.efp.esb.service.facade.hj.LoanOpenAndIssueService;

/**
 * 贷款开立及发放消费接口
 * 
 * @author qiuyf
 * @since 2018年12月20日 下午8:00:35
 * @version 1.0
 */
@Service("loanOpenAndIssueService")
public class LoanOpenAndIssueServiceImpl implements LoanOpenAndIssueService {
	
	/**
	 * 日志记录
	 */
	Logger logger = LoggerFactory.getLogger(LoanOpenAndIssueServiceImpl.class);

	@Override
	public RespLoanOpeAndIssBean loanOpenAndIssue(ReqLoanOpeAndIssBean reqLoanOpeAndIssBean) throws Exception {
//		// 返回对象
//		RespLoanOpeAndIssBean respLoanOpeAndIssBean = null;
//		logger.info("客户号：" + reqLoanOpeAndIssBean.getClientNo() + "贷款开立及发放交易开始");
//		try {
//			// 1.调用ESB客户端服务
//			respLoanOpeAndIssBean = ESBClientFactory.buildClient().withBody(reqLoanOpeAndIssBean).withTradeNo("")
//					.create().sendAndReceive().getBody(RespLoanOpeAndIssBean.class);
//			// 2.判断是否正常获取合同号
//			if (null != respLoanOpeAndIssBean) {
//				if(!StringUtil.isEmpty(respLoanOpeAndIssBean.getBaseAcctNo()) && !StringUtil.isEmpty(respLoanOpeAndIssBean.getAcctSeqNo())) {
//					logger.info("客户号：" + reqLoanOpeAndIssBean.getClientNo() + " 发放号：" +respLoanOpeAndIssBean.getAcctSeqNo());
//					logger.info("客户号：" + reqLoanOpeAndIssBean.getClientNo() + " 贷款号：" +respLoanOpeAndIssBean.getAcctSeqNo());
//				} else {
//					throw new BizException("放款返回数据异常！" + " 发放号：" +respLoanOpeAndIssBean.getAcctSeqNo() + " 贷款号：" +respLoanOpeAndIssBean.getAcctSeqNo());
//				}
//			} else {
//				throw new BizException("放款返回数据异常！");
//			}
//		} catch (Exception e) {
//			logger.info("调用放款接口失败！");
//			throw e;
//		}

		return new RespLoanOpeAndIssBean();
	}

}
